<%--
  Created by IntelliJ IDEA.
  User: 86185
  Date: 2024/6/20
  Time: 9:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="admin/css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/jquery.js"></script>

    <script type="text/javascript">
        $(document).ready(function(){
            $(".click").click(function(){
                $(".tip").fadeIn(200);
            });

            $(".tiptop a").click(function(){
                $(".tip").fadeOut(200);
            });

            $(".sure").click(function(){
                $(".tip").fadeOut(100);
            });

            $(".cancel").click(function(){
                $(".tip").fadeOut(100);
            });

        });
    </script>


</head>


<body>

<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="#">首页</a></li>
        <li><a href="#">数据表</a></li>
        <li><a href="#">基本内容</a></li>
    </ul>
</div>

<div class="rightinfo">

    <div class="tools">

        <ul class="toolbar">
            <li class="click"><a href="admin/addGoodsType.jsp"><span><img src="admin/images/t01.png"/></span>添加</a></li>
            <li><a href="javascript:void(0)" id="deleteAll"><span><img src="admin/images/t03.png" /></span>删除</a></li>
        </ul>

    </div>

    <form id="form" action="DeleteShopSortServlet" method="get">
        <table class="tablelist">
            <thead>
            <tr>
                <th><input type="checkbox" id="selectAll"/></th>
                <th>编号<i class="sort"><img src="admin/images/px.gif" /></i></th>
                <th>商品类型名称</th>
                <th>商品类型简介</th>
                <th>商品类</th>
                <th>权限</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${allShopType}" var="goodsType" varStatus="status">
                <tr>
                    <td><input name="ids" type="checkbox" value="${goodsType.id}" /></td>
                    <td>${status.index + 1}</td>
                    <td>${goodsType.goodsType}</td>
                    <td>${goodsType.mark}</td>
                    <td>${goodsType.parentId}</td>
                    <td>
                        <a href="GetShopSortByIdServlet?id=${goodsType.id}" class="tablelink">修改</a>
                        <a href="DeleteShopSortServlet?ids=${goodsType.id}" class="tablelink">删除</a>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </form>
    <script>

        var del = document.getElementById("deleteAll");
        del.onclick = function(){
            //需要判断是否有复选框被选中
            var ids = document.getElementsByName("ids");
            var flag = false;
            for(var i = 0;i<ids.length;i++){
                //只需要判断至少有一个复选框被选中
                if(ids[i].checked == true){
                    flag = true;//改变标记
                    break;//结束循环
                }
            }
            if(flag == true){
                if(confirm("您确定删除吗？")){
                    var form = document.getElementById("form");
                    form.submit();
                }
            }else{
                alert("请先选中条目！！");
            }
        };

        //全选
        var selectAll = document.getElementById("selectAll");
        selectAll.onclick = function(){
            //所有复选框
            var ids = document.getElementsByName("ids");
            console.log("ids: ", ids)
            for(var i = 0;i < ids.length;i++){
                ids[i].checked = selectAll.checked;
            }
        };
    </script>
    <div class="pagin">
        <div class="message">共<i class="blue">1256</i>条记录，当前显示第&nbsp;<i class="blue">2&nbsp;</i>页</div>
        <ul class="paginList">
            <li class="paginItem"><a href="javascript:;"><span class="pagepre"></span></a></li>
            <li class="paginItem"><a href="javascript:;">1</a></li>
            <li class="paginItem current"><a href="javascript:;">2</a></li>
            <li class="paginItem"><a href="javascript:;">3</a></li>
            <li class="paginItem"><a href="javascript:;">4</a></li>
            <li class="paginItem"><a href="javascript:;">5</a></li>
            <li class="paginItem more"><a href="javascript:;">...</a></li>
            <li class="paginItem"><a href="javascript:;">10</a></li>
            <li class="paginItem"><a href="javascript:;"><span class="pagenxt"></span></a></li>
        </ul>
    </div>


    <div class="tip">
        <div class="tiptop"><span>提示信息</span><a></a></div>

        <div class="tipinfo">
            <span><img src="images/ticon.png" /></span>
            <div class="tipright">
                <p>是否确认对信息的修改 ？</p>
                <cite>如果是请点击确定按钮 ，否则请点取消。</cite>
            </div>
        </div>

        <div class="tipbtn">
            <input name="" type="button"  class="sure" value="确定" />&nbsp;
            <input name="" type="button"  class="cancel" value="取消" />
        </div>

    </div>




</div>

<script type="text/javascript">
    $('.tablelist tbody tr:odd').addClass('odd');
</script>

</body>

</html>

